import java.util.HashMap;
import java.util.Map;

public class thred {
    public static void main(String[] args) {
        //创建一个线程对象
 MyThread myThread=new MyThread();
 //

        Thread t=new Thread(myThread,"线程0");
        Thread t1=new Thread(myThread,"线程1");
        t.start();
        t1.start();
    }
}
class MyThread implements Runnable{
    private  int i=1000;
    Object object=new Object();
    public void run(){
       while (true){
           synchronized (object){
               show();
           }
       }
    }
    public void show(){
       Map map= new HashMap();
     synchronized (object){
         if(i>0){
             try {
                 Thread.sleep(3);

             } catch (InterruptedException e) {
                 e.printStackTrace();
             }
             System.out.println(Thread.currentThread()+"......"+i--);
         }
     }

    }
}
